import { stringify } from 'qs';
import {request} from '../utils/request';
import { getConfig } from '../../config';
const config = getConfig();

// 获取设备综合管理列表--------------------------------------------------------------------
export async function queryIntegratedList(params) {
  return request('/device/deviceinfo/list', {
    method: 'POST',
    body: params,
  });
}


// 设备添加
export async function saveAddEquipment(params) {
  return request('/device/deviceinfo/save', {
    method: 'POST',
    body: params,
  });
}


// 设备修改
export async function saveEditEquipment(params) {
  return request('/device/deviceinfo/update', {
    method: 'POST',
    body: params,
  });
}



// 设备详情
export async function queryEquipmentInfo(params) {
  if (config.isMock) {
    return request(`/device/deviceinfo/info`, {
      method: 'POST',
      body: params,
    });
  }else{
    return request(`/device/deviceinfo/info/${params.devId}`, {
      method: 'POST',
    });
  }
}


// 设备加入白名单
export async function actionEquipmentWiteList(params) {
  return request('/device/deviceinfo/setWhiteName', {
    method: 'POST',
    body: params,
  });
}

// 取消白名单
export async function actionEquipmentWiteListCancel(params) {
  return request('/device/deviceinfo/cancelWhiteName', {
    method: 'POST',
    body: params,
  });
}


// 设备报废
export async function actionEquipmentScrap(params) {
  return request('/device/deviceinfo/setDevInvalid', {
    method: 'POST',
    body: params,
  });
}
// 设备删除
export async function actionEquipmentDel(params) {
  return request('/device/deviceinfo/delete', {
    method: 'POST',
    body: params,
  });
}

// 设备 导出
export async function actionEquipmentExport(params) {
  return request(
    "02100007",
    {
      method: "POST",
      body: params
    },
    null,
    null,
    "download"
  );
}



// 安装点位模糊查询--------------------------------------------------------------------
export async function queryFuzzyInstallationSite(params) {
  return request('/sys/syspoint/queryList', {
    method: 'POST',
    body: params,
  });
}


// 设备批量导入
export async function actionEquipmentImport(params) {
  return request('02100008', {
    method: 'POST',
    body: params,
  });
}

// 单个设备维修记录查询
export async function queryRepairLog(params) {
  return request('/repair/repairinfo/queryDevRepairList', {
    method: 'POST',
    body: params,
  });
}

// 单个设备养护记录查询
export async function queryMaintenlog(params) {
  return request('/maintain/maintaintask/queryTaskDevsByDevId', {
    method: 'POST',
    body: params,
  });
}

// 单个设备操作日志
export async function queryOperationlog(params) {
  return request('/device/deviceolog/list', {
    method: 'POST',
    body: params,
  });
}

// 设备管理员一次性全量列表数据
// export async function queryManagerListForSelect(params) {
//   return request('02100012', {
//     method: 'POST',
//     body: params,
//   });
// }

// 养护点（设备）列表
export async function queryCuringList(params) {
  return request('/device/deviceinfo/list', {
    method: 'POST',
    body: params,
  });
}
